#include <glib-object.h>
#include <libglnx.h>
+#include "ostree-autocleanups.h"
#include "ostree-remote-private.h"
#include "ostree-repo.h"
#include "ostree-repo-private.h"
while (g_hash_table_iter_next (&iter, (gpointer *) &remote_name, (gpointer *) &supported_ref_to_checksum))
{
g_autoptr(GError) local_error = NULL;
- OstreeRemote *remote;
+ g_autoptr(OstreeRemote) remote = NULL;
/* We don’t know what last-modified timestamp the remote has without
* making expensive HTTP queries, so leave that information blank. We
{
gsize i;
g_auto(GStrv) remotes = NULL;
- OstreeRemote *keyring_remote = NULL;
+ g_autoptr(OstreeRemote) keyring_remote = NULL;
g_return_val_if_fail (OSTREE_IS_REPO (self), NULL);
g_return_val_if_fail (ostree_validate_collection_id (collection_id, NULL), NULL);
{
g_debug ("%s: Ignoring remote ‘%s’ as it has no keyring configured.",
G_STRFUNC, remotes[i]);
+ g_clear_object (&keyring_remote);
continue;
}
}
if (keyring_remote != NULL)
- return ostree_remote_ref (keyring_remote);
+ return g_steal_pointer (&keyring_remote);
else
{
g_set_error (error, G_IO_ERROR, G_IO_ERROR_NOT_FOUND,
g_autofree char *gpgkeypath = NULL;
/* Add the remote's keyring file if it exists. */
- OstreeRemote *remote;
+ g_autoptr(OstreeRemote) remote = NULL;
remote = _ostree_repo_get_remote_inherited (self, remote_name, error);
if (remote == NULL)
if (gpgkeypath)
_ostree_gpg_verifier_add_key_ascii_file (verifier, gpgkeypath);
-
- ostree_remote_unref (remote);
}
if (add_global_keyring_dir)